


#ifndef PF_CLIPBOARD_H
#define PF_CLIPBOARD_H

#include <iostream>
#include "pf_graphic.h"
#include "lx_Export.h"

#define PF_CLIPBOARD PF_Clipboard::instance()

class PF_Block;
class PF_Layer;
class PF_Entity;

/**
 * LXCAD internal clipboard. We don't use the system clipboard for
 * better portaility.
 * Implemented as singleton.
 *

 */
class LX_EXPORT PF_Clipboard {
protected:
    PF_Clipboard() {
    }

public:
    /**
     * @return Instance to the unique clipboard object.
     */
    static PF_Clipboard* instance() {
        if (uniqueInstance==NULL) {
            uniqueInstance = new PF_Clipboard();
        }
        return uniqueInstance;
    }

	void clear();

	void addBlock(PF_Block* b);
        bool hasBlock(const QString& name);
	int  countBlocks() {
		return graphic.countBlocks();
	}
	PF_Block* blockAt(int i) {
		return graphic.blockAt(i);
	}
	
	void addLayer(PF_Layer* l);
        bool hasLayer(const QString& name);
	int  countLayers() {
		return graphic.countLayers();
	}
	PF_Layer* layerAt(int i) {
		return graphic.layerAt(i);
	}

	void addEntity(PF_Entity* e);

	uint count() {
		return graphic.count();
	}
	PF_Entity* entityAt(uint i) {
		return graphic.entityAt(i);
	}
	PF_Entity* firstEntity() {
		return graphic.firstEntity();
	}
	
	PF_Entity* nextEntity() {
		return graphic.nextEntity();
	}

	PF_Graphic* getGraphic() {
		return &graphic;
	}

    friend std::ostream& operator << (std::ostream& os, PF_Clipboard& cb);

protected:
    static PF_Clipboard* uniqueInstance;

	PF_Graphic graphic;
};

#endif

